/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "motivos", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Motivos.findAll", query = "SELECT m FROM Motivos m"),
    @NamedQuery(name = "Motivos.findByIdmotivos", query = "SELECT m FROM Motivos m WHERE m.idmotivos = :idmotivos"),
    @NamedQuery(name = "Motivos.findByMotDescrip", query = "SELECT m FROM Motivos m WHERE m.motDescrip = :motDescrip")})
public class Motivos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idmotivos", nullable = false)
    private Integer idmotivos;
    @Column(name = "mot_descrip")
    private Integer motDescrip;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idmotivos")
    private Collection<DescuentoPer> descuentoPerCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idmotivos")
    private Collection<Permisos> permisosCollection;

    public Motivos() {
    }

    public Motivos(Integer idmotivos) {
        this.idmotivos = idmotivos;
    }

    public Integer getIdmotivos() {
        return idmotivos;
    }

    public void setIdmotivos(Integer idmotivos) {
        this.idmotivos = idmotivos;
    }

    public Integer getMotDescrip() {
        return motDescrip;
    }

    public void setMotDescrip(Integer motDescrip) {
        this.motDescrip = motDescrip;
    }

    @XmlTransient
    public Collection<DescuentoPer> getDescuentoPerCollection() {
        return descuentoPerCollection;
    }

    public void setDescuentoPerCollection(Collection<DescuentoPer> descuentoPerCollection) {
        this.descuentoPerCollection = descuentoPerCollection;
    }

    @XmlTransient
    public Collection<Permisos> getPermisosCollection() {
        return permisosCollection;
    }

    public void setPermisosCollection(Collection<Permisos> permisosCollection) {
        this.permisosCollection = permisosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmotivos != null ? idmotivos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Motivos)) {
            return false;
        }
        Motivos other = (Motivos) object;
        if ((this.idmotivos == null && other.idmotivos != null) || (this.idmotivos != null && !this.idmotivos.equals(other.idmotivos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Motivos[ idmotivos=" + idmotivos + " ]";
    }
    
}
